package cums.logic.impl;

import cums.db.iface.UsersDao;
import cums.db.pers.Users;
import cums.logic.iface.UserService;

/**
 * @time Dec 10, 2009, 3:05:44 AM
 * @author fdcube
 */
public class UserServiceImpl implements UserService {

    private UsersDao usersDao;

    public void setUsersDao(UsersDao usersDao) {
        this.usersDao = usersDao;
    }

    public Users Login(Users value) {
        System.out.println("User Login Start!");
        try {
            System.out.println("User Login Start Trying!");
            Users tmp = usersDao.FindUser(value).get(0);
            System.out.println("LoginOk---------" + tmp.getUname());
            return tmp;
        } catch (Exception e) {
            System.out.println("User Login Fail");
            System.out.println(e);
            return null;
        }
    }

    public Users Register(Users value) {
        return usersDao.AddorUpdateUsers(value);
    }
}
